#ifndef _DEBUG_H
#define _DEBUG_H

#include <stdio.h>

/**
 * @def DEBUG(x)
 * @brief Print debug messages
 * @note Usage: DEBUG(("This is debug message"))
 */

#ifdef DEBUGGING
#define DEBUG(x) do { \
    fprintf(stderr, "%s(): ", __func__); \
    debug_print x; } while (0)
//#define DEBUG(x) debug_print x
#else
/* let compiler see debug codes so that it can help us to check it */
#define DEBUG(x) do { if (0) debug_print x; } while (0)
#endif

extern void debug_print(const char *fmt, ...);

#endif /* ! _DEBUG_H */
